using STHPMS1.ICore;
using STHPMS1.ICore.I_Common;
using STHPMS1.ICore.I_Core;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Serv;
using STHPMS1.ICore.I_UI;
using STHPMS1.Web.W_Model;
namespace STHPMS1.Web.W_Core
{
	public class WebModule : DisposeObject//, IModule
	{
		public static void Init ()
        {
            System.Diagnostics.Debug.WriteLine("WebModule");
			IUIFactory factory = new UIFactory ();
			IUIFacade facade = new UIFacade ();
            IGlobalData data = new GlobalDataModel();

			MyApp.Locator.AddBuilder<IObjectFactory> (() => factory, TypeStringDefinition.UIFACTORY);
            MyApp.Locator.AddBuilder<IFacade>(() => facade, TypeStringDefinition.UIFACADE);

            MyApp.Locator.AddBuilder<IGlobalData>(() => data);  
			MyApp.Locator.AddBuilder<IUIFactory> (() => new UIFactory ());
			MyApp.Locator.AddBuilder<IUIFacade> (() => new UIFacade ());
            MyApp.Locator.AddBuilder<IConfigInfo>(() => new ConfigInfo());            
		}
        
		protected override void OnDispose ()
        {
            MyApp.Locator.RemoveBuidler<IObjectFactory>(TypeStringDefinition.UIFACTORY);
            MyApp.Locator.RemoveBuidler<IFacade>(TypeStringDefinition.UIFACADE);

            MyApp.Locator.RemoveBuidler<IGlobalData>();
            MyApp.Locator.RemoveBuidler<IUIFactory>();
            MyApp.Locator.RemoveBuidler<IUIFacade>();
            MyApp.Locator.RemoveBuidler<IConfigInfo>();
		}
	}
}
